]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
texture-cache: remove unused base64 code path
authorCosimo Cecchi <cosimoc@gnome.org>
Fri, 19 Sep 2014 00:05:04 +0000 (17:05 -0700)
committerJasper St. Pierre <jstpierre@mecheye.net>
Wed, 15 Oct 2014 01:50:48 +0000 (18:50 -0700)
This was introduced in b0c6cf3f to support image data for web search
providers, which do not exist anymore. Just remove it.

https://bugzilla.gnome.org/show_bug.cgi?id=736936

src/st/st-texture-cache.c

index c507c4b3a88e6f383bd62bbe81979d94dcd358ea..8f9a68f66b8f6d2c76c7f6dc9c308d20d31cb0f3 100644 (file)
@@ -405,67 +405,6 @@ out:
   return rotated_pixbuf;
 }
 
-static GdkPixbuf*
-decode_image (const char *val)
-{
-  int i;
-  GError *error = NULL;
-  GdkPixbuf *res = NULL;
-  struct {
-    const char *prefix;
-    const char *mime_type;
-  } formats[] = {
-    { "data:image/x-icon;base64,", "image/x-icon" },
-    { "data:image/png;base64,", "image/png" }
-  };
-
-  g_return_val_if_fail (val, NULL);
-
-  for (i = 0; i < G_N_ELEMENTS (formats); i++)
-    {
-      if (g_str_has_prefix (val, formats[i].prefix))
-        {
-          gsize len;
-          guchar *data = NULL;
-          char *unescaped;
-
-          unescaped = g_uri_unescape_string (val + strlen (formats[i].prefix), NULL);
-          if (unescaped)
-            {
-              data = g_base64_decode (unescaped, &len);
-              g_free (unescaped);
-            }
-
-          if (data)
-            {
-              GdkPixbufLoader *loader;
-
-              loader = gdk_pixbuf_loader_new_with_mime_type (formats[i].mime_type, &error);
-              if (loader &&
-                  gdk_pixbuf_loader_write (loader, data, len, &error) &&
-                  gdk_pixbuf_loader_close (loader, &error))
-                {
-                  res = gdk_pixbuf_loader_get_pixbuf (loader);
-                  g_object_ref (res);
-                }
-              g_object_unref (loader);
-              g_free (data);
-            }
-        }
-    }
-  if (!res)
-    {
-      if (error)
-        {
-          g_warning ("%s\n", error->message);
-          g_error_free (error);
-        }
-      else
-        g_warning ("incorrect data uri");
-    }
-  return res;
-}
-
 static GdkPixbuf *
 impl_load_pixbuf_file (const char     *uri,
                        int             available_width,
@@ -478,9 +417,6 @@ impl_load_pixbuf_file (const char     *uri,
   char *contents = NULL;
   gsize size;
 
-  if (g_str_has_prefix (uri, "data:"))
-    return decode_image (uri);
-
   file = g_file_new_for_uri (uri);
   if (g_file_load_contents (file, NULL, &contents, &size, NULL, error))
     {